/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.intercase.cifrar;

import java.util.Scanner;

/**
 *
 * @author alfredo.cuevas
 */
public class Cifrar {    

    public static void main(String[] args) {
        String numIngresar;
        Scanner scan = new Scanner(System.in);
        System.out.print("Introduce el numero a cifrar: ");
	numIngresar = scan.nextLine();

        
        if(validar_cadena_numerica(numIngresar)){
            if (numIngresar.length()<4) {
                System.out.print("Ingresa una cifra de 4 digitos");
            }else if (numIngresar.length()>4){
                System.out.print("Debes ingresar menos de 4 digitos");

            }else if(numIngresar.length()==4){
                cifrar_numero(numIngresar);
            }
        }else 
             System.out.print("Error");
    }
    
    
    private static boolean validar_cadena_numerica(String numIngresar) {
        boolean esNumero = false;
        try{
            int numero = Integer.parseInt(numIngresar);
            esNumero = true;   
        }catch(NumberFormatException e){
            System.err.println("Error: " + e);
        }       
        return esNumero;
    }
    
    
    private static void cifrar_numero(String numIngresar) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
    
}
